#!/usr/bin/python3
# -*- encoding: utf-8 -*-
'''
@File        :Execl合并.py
@Time        :2020/09/06 13:14:08
@Author      :hejiang
@Software    :vsCode
'''

import pandas as pd
import os

os.chdir(os.path.abspath(os.path.dirname(__file__)))
dfs = []

# 读取当前文件夹
for fname in os.listdir("./"):
    if fname.endswith(".xls") or fname.endswith(".xlsx"):
        df = pd.read_excel(
            fname,
            header=None,
            sheet_name=None
        )
        dfs.extend(df.values())

result = pd.concat(dfs)
result.to_excel("./final.xlsx", index=False)
